﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using METU_CMT.Business;

namespace METU_CMT
{
    public partial class CreateCourseScreen : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void OnBtnAddClicked(object sender, EventArgs e)
        {
            Instructor _instructor = (Instructor)EntityFactory.User;
            CourseInstructor _course = new CourseInstructor(txtCourseName.Text, txtCourseCode.Text, txtSemester.Text);
            _course.AddInstructor( _instructor );
            //_instructor.AddCourse( _course );

            MsgBox1.alert("Course is created");

            ClearFields();

            Response.Redirect( "/InstructorMainScreen.aspx" );
        }

        private void ClearFields()
        {
            txtCourseCode.Text = string.Empty;
            txtCourseName.Text = string.Empty;
            txtSemester.Text = string.Empty;
        }
    }
}